package com.tengniu.api.thread;

import java.util.concurrent.ThreadFactory;

public class PPThreadFactory implements ThreadFactory {
    private String name;
    private int index = -1;

    public PPThreadFactory(String name) {
        this.name = name;
    }

    public Thread newThread(Runnable r) {
        Thread thread = new Thread(r);
        thread.setName(this.name + "-" + ++this.index);
        return thread;
    }
}
